<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->increments('id');
            $table->string('cover_img', 80)->default('./news/default.jpg');
            $table->string('categories', 20);
            $table->string('title', 20);
            $table->integer('visits');
            $table->timestamp('time', 6);
            $table->string('content', 8000);
            $table->integer('u_id')->unsigned()->index();
            $table->foreign('u_id')->references('id')->on('users');

            $table->string('EN_title', 20)->nullable();
            $table->string('EN_content', 8000)->nullable();
            $table->string('EN_categories', 20)->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
